﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Collection;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Disk disk;

        public Form1()
        {
            InitializeComponent();         
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            disk = new Disk("name");
            trackList.DisplayMember = "trackname";
            trackList.ValueMember = "tracklength";

        }

        private void onClickAddTrack(object sender, EventArgs e) 
        {                                                        

            try
            {

                Track track = new Track((string)name.Text, Convert.ToInt32(length.Text), Convert.ToInt32(bitrate.Text), (string)genre.Text, (string)type.Text);
                name.Text = "";
                length.Text = "";
                bitrate.Text = "";
                genre.Text = "";
                type.Text = "";


                disk.addTrack(track);
                trackList.Items.Add(track.Name()+" ("+track.Length()+")");//удален get
                counter.Text = disk.getLength().ToString();

            }
            catch (FormatException)
            {

                trackList.Items.Add("Ошибка! Неверное заполнение формы!");

                name.Text = string.Empty;
                length.Text = string.Empty;
                bitrate.Text = string.Empty;
                genre.Text = string.Empty;
                type.Text = string.Empty;
            
            }
            
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }
    }
}
